<section class="content-header">
	<h1>
		{$catname}
	</h1>
	<ol class="breadcrumb">
		<li><a href="{:U('/Admin/index')}"><i class="fa fa-home"></i>首页</a></li>
		<li class="active">内容管理</li>
	</ol>
</section>
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box box-danger">
				<div class="box-body">
					<form id="content_page_form" onsubmit="return pageFormSubmit()" >
						<table width="100%" cellpadding="2"  class="table">
							<tr>
								<td width="80">标题：</td>
								<td width="450"><input type="text" name="info[title]" value="{$info.title}" style="width:100%" /></td>
								<td></td>
							</tr>
							<tr>
								<td>关键字：</td>
								<td><input type="text" name="info[keywords]" value="{$info.keywords}" style="width:100%" /></td>
								<td></td>
							</tr>
							<tr>
								<td>内容：</td>
								<td colspan="2"><textarea id="content_page_form_textarea_editor" name="info[content]" style="width:90%;height:360px">{$info.content}</textarea></td>
							</tr>
						</table>
						<div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-primary pull-left" type="button" id='form_submit' onclick="$('#content_page_form').submit()">提交</button>
                            </span>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</section>
<!-- 缩略图上传 -->
<script type="text/javascript">
	$(document).ready(function(){
		//转向链接

		//初始化编辑器
		CKEDITOR.replace('content_page_form_textarea_editor',
				{
					filebrowserBrowseUrl: '/ckfinder/ckfinder.html',
					filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html?type=Images',
//				filebrowserUploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&ckCsrfToken={:cookie("ckCsrfToken")}',
					filebrowserImageUploadUrl: '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images'
				} );

	})

	//表单提交
	function pageFormSubmit(){
		$('#content_page_form_textarea_editor').val(CKEDITOR.instances.content_page_form_textarea_editor.getData());
		$.post("{:U('Content/page_iframe',array('catid'=>$catid) )}", $("#content_page_form").serialize(), function(res){
			if(!res.status){
				parent.$.messager.alert('提示信息', res.info, 'error');
			}else{
				parent.$.messager.alert('提示信息', res.info, 'info');
				var url = "{:U('Content/index',array('catid'=>$catid))}";
				loadContent(url);
			}
		});
		return false;
	}

</script>

</body>
</html>
